﻿using System;
using System.Collections.Generic;
using System.Text;
using Slaks.Graphs.GraphBuilder;
namespace Slaks.Graphs.Algorithms.DistanceAlgorithm
{
    public class DistWGU4VertexEdgeCount : WGUGraphDistance
    {
        public DistWGU4VertexEdgeCount () : base ()
        {
			IsVisible = false;
        }

        public DistWGU4VertexEdgeCount(Graph one, Graph two)
            : base(one, two)
        {
			IsVisible = false;
        }

        /// <summary>
		/// distance measure proposed by Wallis
		/// </summary>
		/// <param name="one"></param>
		/// <param name="two"></param>
		/// <returns></returns>
        public override double GetDistance()
		{
            long mcsSize = one.GetMCS(two).GetGraphSizeVertexEdgeCount;
			if (mcsSize == 0) return 1;
            return 1 - (double)mcsSize / (one.GetGraphSizeVertexEdgeCount + two.GetGraphSizeVertexEdgeCount - mcsSize);
		}
		public override bool CanOperateOnRepresentation (GraphBuilder.BuilderType builderType)
		{
			switch(builderType)
			{
				case BuilderType.StandardRepresentationSchenker:
case BuilderType.ExtractorBuilderNodesOnly:
case BuilderType.StandardRepresentationSlaks:
case BuilderType.SimpleRepresentationSchenker:
case BuilderType.SimpleRepresentationSlaks:
case BuilderType.NDistanceRepresentationSchenker:
case BuilderType.NDistanceRepresentationSlaks:
case BuilderType.NSimpleDistanceRepresentationSchenker:
case BuilderType.NSimpleDistanceRepresentationSlaks:
				return true;
			}
			return false;
		}
    }
}
